package com.maiji.cloud.aop;

import com.alibaba.fastjson.JSON;
import com.maiji.cloud.utils.UUID_MD5;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class WebControllerAop {

    Logger logger = LoggerFactory.getLogger(WebControllerAop.class);

    /*@Around("execution(* com.maiji.cloud.controller..*(..))")
    public Object doAroundService(ProceedingJoinPoint proceedingJoinPoint){
        String requestId = UUID_MD5.getUUID();
        try {
            Object[] args = proceedingJoinPoint.getArgs();
            logger.info("doAroundService: " + requestId + " ===>> "+proceedingJoinPoint.getSignature().getName() + ": args ===>> " + JSON.toJSONString(args));
            Object object=proceedingJoinPoint.proceed();
            logger.info("doAroundService: " + requestId + " ===>> "+proceedingJoinPoint.getSignature().getName() + ": return ===>> " + JSON.toJSONString(object));
            return object;
        } catch (Throwable throwable) {
            logger.info("doAroundService: " + requestId + " ===>> "+proceedingJoinPoint.getSignature().getName() + ": throwable");
            throwable.printStackTrace();
        }
        return null;
    }*/

}
